package day02;

import java.util.Scanner;

public class demo {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请问需要计算 1.正方形 2.长方形");
        int age = scan.nextInt();
        System.out.println("请问需要计算 1.周长 2.面积");
        if (age == 1){
            int age1 = scan.nextInt();
            System.out.println("请输入正方形的边长");
            int lenth = scan.nextInt();
            if (age1 == 1){
                int lenth1 = lenth *4;
                System.out.println("此正方形的周长是" + lenth1);
            }else {
                int area1 = lenth * lenth;
                System.out.println("此正方形的面积是" + area1);
            }
        }else if (age == 2 ){
            int age1 = scan.nextInt();
            System.out.println("请输入长方形的第一条边");
            int age2 = scan.nextInt();
            System.out.println("请输入长方形的第二条边");
            int age3 = scan.nextInt();
            if (age1 == 1){
                int lenth1 =  age2*2 + age3 *2;
                System.out.println("此长方形的周长是" + lenth1);
            }else {
                int area1 = age2 * age3;
                System.out.println("此长方形的面积是" + area1);
            }



        }else {
            System.out.println("输入错误,程序终止");
        }


    }
}
